Repetier-Firmware  1.0.0
Distortion Class Reference

Handle distortion related stuff. More...

#include <Distortion.h>

Public Member Functions

 Distortion ()
 
void init ()
 
void enable (bool permanent=true)
 
void disable (bool permanent=true)
 
bool measure (void)
 
int32_t correct (int32_t x, int32_t y, int32_t z) const
 Compute distortion correction at given position. More...
 
void updateDerived ()
 
void reportStatus ()
 
bool isEnabled ()
 
int32_t zMaxSteps ()
 
void set (float x, float y, float z)
 
void showMatrix ()
 
void resetCorrection ()
 

Private Member Functions

int matrixIndex (fast8_t x, fast8_t y) const
 
int32_t getMatrix (int index) const
 
void setMatrix (int32_t val, int index)
 
bool isCorner (fast8_t i, fast8_t j) const
 
INLINE int32_t extrapolatePoint (fast8_t x1, fast8_t y1, fast8_t x2, fast8_t y2) const
 
void extrapolateCorner (fast8_t x, fast8_t y, fast8_t dx, fast8_t dy)
 
void extrapolateCorners ()
 

Private Attributes

int32_t step
 
int32_t radiusCorrectionSteps
 
int32_t zStart
 
int32_t zEnd
 
int32_t matrix [DISTORTION_CORRECTION_POINTS *DISTORTION_CORRECTION_POINTS]
 
bool enabled
 

Detailed Description

Handle distortion related stuff.

Distortion correction can be used to solve problems resulting from an uneven build plate. It allows measuring a nxn grid with a z-probe and add these correction to all moves. Normally you start at the bottom with 100% correction and at 0.5mm you start reducing correction until it vanishes completely at 1-3 mm.

The stored values are steps required to reach the bumped level assuming you are at zMin. So if you have a 1mm indentation it contains -steps per mm.

Constructor & Destructor Documentation

◆ Distortion()

Distortion::Distortion ( )

Member Function Documentation

◆ correct()

int32_t Distortion::correct ( int32_t  x,
int32_t  y,
int32_t  z 
) const

Compute distortion correction at given position.

The current tool offset is added to the CNC position to reference the right distortion point.

Parameters
xcoordinate in CMC steps.
ycoordinate in CMC steps.
zcoordinate in CMC steps.
Returns
Correction required in z steps.

◆ disable()

void Distortion::disable ( bool  permanent = true)

◆ enable()

void Distortion::enable ( bool  permanent = true)

◆ extrapolateCorner()

void Distortion::extrapolateCorner ( fast8_t  x,
fast8_t  y,
fast8_t  dx,
fast8_t  dy 
)
private

◆ extrapolateCorners()

void Distortion::extrapolateCorners ( )
private

◆ extrapolatePoint()

int32_t Distortion::extrapolatePoint ( fast8_t  x1,
fast8_t  y1,
fast8_t  x2,
fast8_t  y2 
) const
inlineprivate

Extrapolates the changes from p1 to p2 to p3 which has the same distance as p1-p2.

◆ getMatrix()

int32_t Distortion::getMatrix ( int  index) const
private

◆ init()

void Distortion::init ( )

◆ isCorner()

bool Distortion::isCorner ( fast8_t  i,
fast8_t  j 
) const
private

◆ isEnabled()

bool Distortion::isEnabled ( )
inline

◆ matrixIndex()

int Distortion::matrixIndex ( fast8_t  x,
fast8_t  y 
) const
private

◆ measure()

bool Distortion::measure ( void  )

◆ reportStatus()

void Distortion::reportStatus ( )

◆ resetCorrection()

void Distortion::resetCorrection ( void  )

◆ set()

void Distortion::set ( float  x,
float  y,
float  z 
)

◆ setMatrix()

void Distortion::setMatrix ( int32_t  val,
int  index 
)
private

◆ showMatrix()

void Distortion::showMatrix ( )

◆ updateDerived()

void Distortion::updateDerived ( )

◆ zMaxSteps()

int32_t Distortion::zMaxSteps ( )
inline

Member Data Documentation

◆ enabled

bool Distortion::enabled
private

◆ matrix

int32_t Distortion::matrix[DISTORTION_CORRECTION_POINTS *DISTORTION_CORRECTION_POINTS]
private

◆ radiusCorrectionSteps

int32_t Distortion::radiusCorrectionSteps
private

◆ step

int32_t Distortion::step
private

◆ zEnd

int32_t Distortion::zEnd
private

◆ zStart

int32_t Distortion::zStart
private

The documentation for this class was generated from the following files: